package net.dengzixu.java.homework.period32;

import java.util.Scanner;

/**
 * @author Deng Zixu <admin@dengzixu.com>
 */
public class Homework {
    public static void main(String[] args) {
        int[] scores = new int[10];

        Scanner scanner = new Scanner(System.in);

        System.out.println("允许输入成绩范围[0 - 100]。");

        // 获取用户对的输入
        for (int i = 0; i < 10; i++) {
            int inputValue = 0;


            System.out.printf("请输入第 %d 个成绩: ", i + 1);
            inputValue = scanner.nextInt();

            if (inputValue < 0 || inputValue > 100) {
                System.out.println("输入成绩不合法，允许输入成绩范围[0 - 100]，重新输入");
                i--;
                continue;
            }

            scores[i] = inputValue;
        }

        // 查找大于 60 的分数并输出。
        for (int i = 0; i < scores.length; i++) {
            if (scores[i] >= 60) {
                System.out.printf("scores[%d] = %d\n", i, scores[i]);
            }
        }
    }
}
